interface MyInterface {
    val name: String
    fun foo(a: Int, b: Int)
}

class Foo() : MyInterface {
    override val name: String

    init {
        name = "ab"
    }

    override fun foo(a: Int, b: Int) {
        println("${a + b} $name")
    }
}

fun Foo.testPrint() {
    println(this.name)
}

// 函数扩展
fun test(f: MyInterface) {
    f.foo(1, 2)
}


fun main() {
    val a = Foo()
    val r = a as MyInterface
    test(r)

    a.testPrint()
}